package ca.ericslandry.client;

import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.control.SmallZoomControl;
import com.google.gwt.maps.client.geom.LatLng;
import com.google.gwt.maps.client.geom.Size;
import com.google.gwt.maps.client.overlay.Icon;
import com.google.gwt.maps.client.overlay.Marker;
import com.google.gwt.user.client.ui.Widget;

public class MapsUtils {
	public final static String[] LETTERS = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };

	public static Icon createPushpinIcon() {
		Icon icon = Icon.newInstance("http://maps.google.com/mapfiles/ms/micons/blue-pushpin.png");
		icon.setIconSize(Size.newInstance(32, 32));
		icon.setShadowURL("http://maps.google.com/mapfiles/ms/micons/pushpin_shadow.png");
		icon.setShadowSize(Size.newInstance(59, 32));
		return icon;
	}

	public static Icon createLetteredIcon(String letter) {
		Icon icon = Icon.newInstance("http://www.google.com/mapfiles/marker" + letter + ".png");
		icon.setIconSize(Size.newInstance(20, 34));
		icon.setShadowURL("http://maps.google.com/mapfiles/ms/micons/msmarker.shadow.png");
		icon.setShadowSize(Size.newInstance(59, 32));
		return icon;
	}
	
	public static Widget getLittleMapWidget(LatLng point) {
		MapWidget map = new MapWidget();
		map.setPixelSize(300, 200);
		map.addControl(new SmallZoomControl());
		map.setCenter(point, 12);
		Marker marker = new Marker(point);
		map.clearOverlays();
		map.addOverlay(marker);
		return map;
	}
}
